import 'package:flutter/services.dart';

import '../bean/EventNotifyBean.dart';

enum EventNotify{
  onIncomingCall,
  onMissedCall,
  onSms,
  onCalendar,
  onHangUp
}

/// Method for parsing battery state.
EventNotifyBean parseEventNotify(MethodCall call) {
  String state = call.method;
  switch (state) {
    case 'onIncomingCall':
      return EventNotifyBean(EventNotify.onIncomingCall, call.arguments['title'], call.arguments['text']);
    case 'onMissedCall':
      return EventNotifyBean(EventNotify.onMissedCall, call.arguments['title'], call.arguments['text']);
    case 'onSms':
      return EventNotifyBean(EventNotify.onSms, call.arguments['title'], call.arguments['text']);
    case 'onCalendar':
      return EventNotifyBean(EventNotify.onCalendar, call.arguments['title'], call.arguments['text']);
    case 'onHangUp':
      return EventNotifyBean(EventNotify.onHangUp, call.arguments['title'], call.arguments['text']);
    default:
      throw ArgumentError('$state is not a valid EventNotify.');
  }
}